package com.foreknow.demo5;

public class MethodDemo6 {

    public static int[] sum(int[] array) {

        //创建一个数组容器(保存奇数和、偶数和、总和)
        int[] container = new int[3];
        //奇数和
        int sum1 = 0;
        //偶数和
        int sum2 = 0;
        //总和
        int sum3 = 0;
        //遍历数组并判断并累加求和

        //要将奇数和、偶数和、总和保存到container这个数组容器中
        container[0] = sum1;
        container[1] = sum2;
        container[2] = sum3;
        return container;
    }

    public static void main(String[] args) {
        int[] array = {2,1,34,56,3,12,13,14,15};
        int[] con =MethodDemo6.sum(array); //container[3]
        //遍历输出结果
        for(int i = 0;i<con.length;i++) {
            System.out.println(con[i]);
        }

    }
}
